rem LucasLehmer, Performs the Lucas Lehmer algorithm
rem Copyright (C) 2014  David McCloskey
rem
rem This program is free software: you can redistribute it and/or modify
rem it under the terms of the GNU General Public License as published by
rem the Free Software Foundation, either version 3 of the License, or
rem (at your option) any later version.
rem
rem This program is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
rem GNU General Public License for more details.
rem
rem You should have received a copy of the GNU General Public License
rem along with this program.  If not, see <http://www.gnu.org/licenses/>.

rem Verify the parameters are valid
if [%1] == [] goto error_need_parameters
if [%2] == [] goto error_need_parameters
if [%3] == [] goto error_need_parameters
if [%4] == [] goto error_need_parameters
if [%5] == [] goto error_need_parameters

if ("%1") neq ("ia32") if ("%1") neq ("intel64") goto error_invalid_parameters
if ("%2") neq ("debug") if ("%2") neq ("release") goto error_invalid_parameters
if ("%3") neq ("vc12") goto error_invalid_parameters

set output_path=%~5
set bin_path=%~4\%1\%3
if ("%2") == ("debug") set suffix=_debug

rem Copy the dlls to the output directory
copy "%bin_path%\tbb%suffix%.dll" "%output_path%" >NUL
copy "%bin_path%\tbb%suffix%.pdb" "%output_path%" >NUL
copy "%bin_path%\tbbmalloc%suffix%.dll" "%output_path%" >NUL
copy "%bin_path%\tbbmalloc%suffix%.pdb" "%output_path%" >NUL
copy "%bin_path%\tbb_preview%suffix%.dll" "%output_path%" >NUL
copy "%bin_path%\tbb_preview%suffix%.pdb" "%output_path%" >NUL
exit /B 0

:error_need_parameters
echo copy_tbb_dlls.bat <ia32|intel64> <debug|release> <vc12> <tbb bin path> <output path>
echo ERROR: This script requires 5 parameters
exit /B 1

:error_invalid_parameters
echo copy_tbb_dlls.bat <tbb bin path> <ia32|intel64> <debug|release> <vc12> <tbb bin path> <output path>
echo ERROR: Invalid parameters
exit /B 1
